﻿using Bll;
using IBll;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class StoreController : ControllerBase, IStoreBll
    {
        public StoreController(IStoreBll storeBll)
        {
            StoreBll = storeBll;
        }

        public IStoreBll StoreBll { get; }

        [HttpPost("AddAsync")]
        public Task<int> AddAsync(StoreInfo storeInfo)
        {
            return StoreBll.AddAsync(storeInfo);
        }
        [HttpGet("GetStores")]
        public dynamic GetStores(string? name)
        {
            return StoreBll.GetStores(name);
        }
        [HttpPut("UpdateAsync")]
        public Task<int> UpdateAsync(StoreInfo storeInfo)
        {
           return StoreBll.UpdateAsync(storeInfo);
        }
    }
}
